package 题目集.二分;

import java.util.Scanner;

/**
 * https://www.acwing.com/problem/content/4959/
 */
public class ch09_炼金 {
    static int maxN = (int) 1e4 + 1;
    static int[][] arr = new int[maxN][2]; //0，o的数量，1，x的数量
    static int n;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            arr[i][0] = sc.nextInt();
            arr[i][1] = sc.nextInt();
        }
        int max = findMax(1, (int) 1e9);
        int min = findMin(1, max);
        System.out.println(min + " " + max);
    }

    public static int findMax(int l, int r) {
        while (l <= r) {
            int m = l + (r - l >> 1);
            if (check(m) <= 0) {
                l = m + 1;
            } else {
                r = m - 1;
            }
        }
        if (check(l) <= 0) {
            return l;
        }
        return r;
    }

    public static int findMin(int l, int r) {
        while (l <= r) {
            int m = l + (r - l >> 1);
            if (check(m) < 0) {
                l = m + 1;
            } else {
                r = m - 1;
            }
        }
        if (check(l) == 0) {
            return l;
        }
        return r;
    }

    /**
     * 返回1，v大了，0刚刚好，-1小了
     * @param v
     * @return
     */
    public static int check(int v) {
        for (int i = 0; i < n; i++) {
            int cnt = arr[i][0] / v;
            if (cnt != arr[i][1]) {
                return arr[i][1] > cnt ? 1 : -1;
            }
        }
        return 0;
    }
}
